home *** CD-ROM | disk | FTP | other *** search
- /* macaboutbox.c - Display the "about box" of the application. */
- /* Written by Brian Kendig. */
- /* The functions here are only used by macint.c. */
-
- #include <THINK.h>
- #include <Dialogs.h>
- #include <Fonts.h>
- #include <Menus.h>
- #include <Quickdraw.h>
- #include <Resources.h>
- #include <ToolUtils.h>
- #include <Traps.h>
- #include <Windows.h>
- #include "macint.h"
-
- static DialogPtr aboutBox;
- extern Boolean hasColorQD;
-
- static enum {
- theOKButton = 1,
- theOKOutline = 2,
- theIcon = 3,
- theName = 4,
- theAboutText = 5,
- theCopyright = 6
- } ;
-
- pascal void DrawOKOutline (WindowPtr dialogWindow, short theItem) {
- PenState oldPen;
- short iType;
- Handle iHandle;
- Rect iRect;
-
- GetPenState (&oldPen);
- PenNormal ();
- PenSize (3,3);
-
- GetDItem (aboutBox, theOKButton, &iType, &iHandle, &iRect);
- InsetRect (&iRect, -4, -4);
- FrameRoundRect (&iRect, 16, 16);
-
- SetPenState (&oldPen);
- }
-
- pascal void DrawIcon (WindowPtr dialogWindow, short theItem) {
- short iType;
- Handle iHandle;
- Rect iRect;
-
- GetDItem (aboutBox, theIcon, &iType, &iHandle, &iRect);
- PlotIcon (&iRect, GetResource ('ICN#', 128));
- }
-
- pascal void DrawName (WindowPtr dialogWindow, short theItem) {
- short iType;
- Handle iHandle;
- Rect iRect;
- Str255 string;
-
- TextFont (helvetica);
- TextSize (24);
- TextFace (0);
- GetDItem (aboutBox, theName, &iType, &iHandle, &iRect);
- GetIndString (string, STRINGS_RES, 1);
- TextBox (string+1, string[0], &iRect, teFlushLeft);
- }
-
- pascal void DrawAboutText (WindowPtr dialogWindow, short theItem) {
- short iType;
- Handle iHandle;
- Rect iRect;
- Str255 string;
-
- TextFont (monaco);
- TextSize (9);
- TextFace (0);
- GetDItem (aboutBox, theAboutText, &iType, &iHandle, &iRect);
- GetIndString (string, STRINGS_RES, 2);
- TextBox (string+1, string[0], &iRect, teFlushLeft);
- }
-
- pascal void DrawCopyright (WindowPtr dialogWindow, short theItem) {
- short iType;
- Handle iHandle;
- Rect iRect;
- Str255 string;
-
- TextFont (systemFont);
- TextSize (12);
- TextFace (0);
- GetDItem (aboutBox, theCopyright, &iType, &iHandle, &iRect);
- GetIndString (string, STRINGS_RES, 3);
- TextBox (string+1, string[0], &iRect, teFlushLeft);
- }
-
- void DoAboutBox (void) {
- short itemType, itemHit = 0;
- Handle itemHandle;
- Rect itemRect;
-
- aboutBox = GetNewDialog (ABOUT_BOX, NIL, (WindowPtr) -1);
-
- GetDItem (aboutBox, theOKOutline, &itemType, &itemHandle, &itemRect);
- SetDItem (aboutBox, theOKOutline, itemType, (Handle) DrawOKOutline, &itemRect);
-
- GetDItem (aboutBox, theIcon, &itemType, &itemHandle, &itemRect);
- SetDItem (aboutBox, theIcon, itemType, (Handle) DrawIcon, &itemRect);
-
- GetDItem (aboutBox, theName, &itemType, &itemHandle, &itemRect);
- SetDItem (aboutBox, theName, itemType, (Handle) DrawName, &itemRect);
-
- GetDItem (aboutBox, theAboutText, &itemType, &itemHandle, &itemRect);
- SetDItem (aboutBox, theAboutText, itemType, (Handle) DrawAboutText, &itemRect);
-
- GetDItem (aboutBox, theCopyright, &itemType, &itemHandle, &itemRect);
- SetDItem (aboutBox, theCopyright, itemType, (Handle) DrawCopyright, &itemRect);
-
- ShowWindow (aboutBox);
-
- itemHit = 0;
- while (itemHit != ok) ModalDialog (NIL, &itemHit);
-
- DisposDialog (aboutBox);
-
- }
-
-